package com.efounder.adapter;

import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.efounder.fragment.AssessFragment;
import com.efounder.fragment.MallOrderToPayFragment;

/**
 * Created by will on 18-2-2.
 * @author will
 */

public class CommentPagerAdapter extends FragmentPagerAdapter {

    private String[] titles;

    public CommentPagerAdapter(FragmentManager fm, String[] titles) {
        super(fm);
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            AssessFragment assessFragment = AssessFragment.newInstance();
            Bundle bundle = new Bundle();
            bundle.putString("type", "0");
            assessFragment.setArguments(bundle);
            return assessFragment;
        }else if (position == 1) {
            AssessFragment assessFragment = AssessFragment.newInstance();
            Bundle bundle = new Bundle();
            bundle.putString("type", "1");
            assessFragment.setArguments(bundle);
            return assessFragment;
        }
        return new MallOrderToPayFragment();
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
